package com.zixuan.common;


import com.sun.org.apache.xpath.internal.operations.Bool;
import lombok.Data;

/**
 * 统一结果返回类
 */
@Data
public class Result {
    private int code;
    private String message;
    private Boolean flag;
    private Object data;
    public Result(){}
    public Result(int code, Boolean flag,String message){
        this.code = code;
        this.flag = flag;
        this.message = message;
    }

    public Result(int code, Boolean flag,String message,Object data){
        this.code = code;
        this.flag = flag;
        this.message = message;
        this.data = data;
    }

    public static Result ok(){
        Result result = new Result();
        result.setCode(200);
        result.setFlag(true);
        result.setMessage("SUCCESS");
        return result;
    }

    public static Result err(){
        Result result = new Result();
        result.setCode(1001);
        result.setFlag(false);
        result.setMessage("FAIL");

        return result;
    }


}
